<template>
  <div>
    添加书名<input type="text" v-model="bb.name"><br>
    添加价格<input type="text" v-model="bb.price"><br>
    <button @click="tj()">确认添加</button><br>
    <input type="text" v-model="name"><br>
    <button @click="ti()">搜索</button>
      <table>
        <tr>
          <td>ID</td>
          <td>书名</td>
          <td>价格</td>
          <td>所属分类</td>
        </tr>
        <tr v-for="i in aa">
          <td>{{i.id}}</td>
          <td>{{i.name}}</td>
          <td>{{i.price}}</td>
          <td>{{i.cate_name}}</td>
        </tr>
      </table>
  </div>
</template>

<script>
export default {
  name:'aaa',
  data(){
    return{
      aa:[],
      tpage:0,
      name:'',
      bb:{}
    }
  },
  methods:{
    gen(p){
      this.$axios.get(`bb/?p=`+p).then(item=>{
        this.aa = item.data.list
      })
    },
    ti(){
      this.$axios.get(`cc/`.this.name).then(item=>{

      })
    },
    tj(){
      this.$axios.post(`bb/`,this.bb).then(item=>{

      })
    }

  },
  mounted(){
    this.gen(1)
  }
}
</script>

<style>

</style>